package com.dys.entity;

import cn.afterturn.easypoi.excel.annotation.*;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @Author: 疾风
 * @ClassName: User
 * @Description: 实体类
 * @CreateDate: 2024/12/09
 * @Version: v1.0.0
 */
@ExcelTarget(value = "用户资料")
public class User implements Serializable {
    @Excel(name = "编号", orderNum = "1")
    private int id;
    @Excel(name = "姓名", orderNum = "2")
    private String name;
    @Excel(name = "年龄", orderNum = "4", suffix = "岁")
    private int age;
    @Excel(name = "生日", orderNum = "3", width = 30.2, format = "yyyy年MM月dd日 hh时mm分ss秒")
    private Date birthDate;

    @Excel(name = "状态",orderNum = "5",replace = {"激活_1","未激活_0"})
    private String status;

    @Excel(name = "爱好",orderNum = "6")
    @ExcelIgnore
    private List<String> hobby;

    @Excel(name = "爱好",orderNum = "6")
    private List<String> hobbyStr;

    @Excel(name = "头像",width = 13,height = 13,orderNum = "7",type = 2)
    private String photo;

    @ExcelEntity(name = "身份信息")
    private Card card;

    @ExcelCollection(name = "订单信息",orderNum = "9")
    private List<Order> orders;



    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public Date getBirthDate() {
        return birthDate;
    }

    public void setBirthDate(Date birthDate) {
        this.birthDate = birthDate;
    }

    public Card getCard() {
        return card;
    }

    public void setCard(Card card) {
        this.card = card;
    }

    public List<Order> getOrders() {
        return orders;
    }

    public void setOrders(List<Order> orders) {
        this.orders = orders;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public List<String> getHobby() {
        return hobby;
    }

    public void setHobby(List<String> hobby) {
        this.hobby = hobby;
    }

    /**
     * 自定义导出格式
     * @return 自定义导出格式
     */
    public String getHobbyStr() {
        String result = this.hobbyStr.stream().map(Object::toString).collect(Collectors.joining("、"));
        return result;
    }

    public void setHobbyStr(List<String> hobbyStr) {
        this.hobbyStr = hobbyStr;
    }

    public String getPhoto() {
        return photo;
    }

    public void setPhoto(String photo) {
        this.photo = photo;
    }
}
